/******************************************************************************* * Copyright (c) 2009, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.jdt.debug.testplugin; import org.eclipse.debug.core.DebugException; import org.eclipse.jdt.core.dom.Message; import org.eclipse.jdt.debug.core.IJavaBreakpoint; import org.eclipse.jdt.debug.core.IJavaBreakpointListener; import org.eclipse.jdt.debug.core.IJavaDebugTarget; import org.eclipse.jdt.debug.core.IJavaLineBreakpoint; import org.eclipse.jdt.debug.core.IJavaThread; import org.eclipse.jdt.debug.core.IJavaType; /** * Listens to all breakpoint notifications. */ public class GlobalBreakpointListener implements IJavaBreakpointListener { public static IJavaBreakpoint ADDED; public static IJavaBreakpoint HIT; public static IJavaBreakpoint INSTALLED; public static IJavaBreakpoint REMOVED; public static IJavaBreakpoint INSTALLING; public static void clear() { ADDED = null; HIT = null; INSTALLED = null; REMOVED = null; INSTALLING = null; } public GlobalBreakpointListener() { } @Override public void addingBreakpoint(IJavaDebugTarget target, IJavaBreakpoint breakpoint) { ADDED = breakpoint; } @Override public void breakpointHasCompilationErrors(IJavaLineBreakpoint breakpoint, Message[] errors) { } @Override public void breakpointHasRuntimeException(IJavaLineBreakpoint breakpoint, DebugException exception) { } @Override public int breakpointHit(IJavaThread thread, IJavaBreakpoint breakpoint) { HIT = breakpoint; return DONT_CARE; } @Override public void breakpointInstalled(IJavaDebugTarget target, IJavaBreakpoint breakpoint) { INSTALLED = breakpoint; } @Override public void breakpointRemoved(IJavaDebugTarget target, IJavaBreakpoint breakpoint) { REMOVED = breakpoint; } @Override public int installingBreakpoint(IJavaDebugTarget target, IJavaBreakpoint breakpoint, IJavaType type) { INSTALLING = breakpoint; return DONT_CARE; } }